var express = require('express');
var router = express.Router();

const db = require('../public/javascripts/db')

/* GET home page. */
router.get('/', function(req, res, next) {
    var id = req.query.id;
    let sql = "select * from hotspot where id = ?";
    let data = [id];
    db(sql, data, (result)=>{
        if(result.length>0){
            res.json({
                code:200,
                message:"查询成功",
                data:result[0]
            })
        }else{
            res.json({
                code:201,
                message:"查询失败"
            })
        }
    })
});

module.exports = router;